package com.kaishengit.entity;

import java.util.List;

public class Page {
	public Page(int nowPage, int count, int totalCount) {
		this.totalCount = totalCount;
		setCount(count);
		setMaxPage();
		setNowPage(nowPage);

	}

	private int nowPage;
	private int maxPage;
	private int totalCount;
	private int count;
	private List<All> list;

	public int getNowPage() {
		return nowPage;
	}

	public void setNowPage(int nowPage) {
		if (nowPage < 0) {
			this.nowPage = 0;
		} else if (nowPage > maxPage) {
			nowPage = maxPage - 1;
		} else {
			this.nowPage = nowPage;
		}

	}

	public int getMaxPage() {
		return maxPage;
	}

	public void setMaxPage() {
		if (this.maxPage != 0) {

			this.maxPage = totalCount / count;
			if (totalCount % count != 0) {
				this.maxPage++;
			}
		}else{
			this.totalCount=0;
		}
	}

	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		if (count > totalCount) {
			this.count = totalCount;
		} else {
			this.count = count;
		}
	}

	public List<All> getList() {
		return list;
	}

	public void setList(List<All> list) {
		this.list = list;
	}

}
